package com.zjgsu.coursecalendar.model;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "homework_user", schema = "course", catalog = "")
public class HomeworkUser {
    private int homeworkUserId;
    private Integer homeworkId;
    private Integer userId;
    private Timestamp createTime;
    private String mark;
    private String comment;

    @Id
    @Column(name = "homework_user_id")
    public int getHomeworkUserId() {
        return homeworkUserId;
    }

    public void setHomeworkUserId(int homeworkUserId) {
        this.homeworkUserId = homeworkUserId;
    }

    @Basic
    @Column(name = "homework_id")
    public Integer getHomeworkId() {
        return homeworkId;
    }

    public void setHomeworkId(Integer homeworkId) {
        this.homeworkId = homeworkId;
    }

    @Basic
    @Column(name = "user_id")
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "mark")
    public String getMark() {
        return mark;
    }

    public void setMark(String mark) {
        this.mark = mark;
    }

    @Basic
    @Column(name = "comment")
    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        HomeworkUser that = (HomeworkUser) o;

        if (homeworkUserId != that.homeworkUserId) return false;
        if (homeworkId != null ? !homeworkId.equals(that.homeworkId) : that.homeworkId != null) return false;
        if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
        if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false;
        if (mark != null ? !mark.equals(that.mark) : that.mark != null) return false;
        if (comment != null ? !comment.equals(that.comment) : that.comment != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = homeworkUserId;
        result = 31 * result + (homeworkId != null ? homeworkId.hashCode() : 0);
        result = 31 * result + (userId != null ? userId.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (mark != null ? mark.hashCode() : 0);
        result = 31 * result + (comment != null ? comment.hashCode() : 0);
        return result;
    }
}
